import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEMethodDTO } from './ipsdemethod-dto';
import { IPSLinkDEMethodDTO } from './ipslink-demethod-dto';
import { PSDEMethodDTOImpl } from './psdemethod-dtoimpl';

export class PSLinkDEMethodDTOImpl extends PSDEMethodDTOImpl implements IPSLinkDEMethodDTO {
  protected refpsdemethoddto: IPSDEMethodDTO | null = null;

  getRefPSDEMethodDTO(): IPSDEMethodDTO | null {
    if (this.refpsdemethoddto != null) return this.refpsdemethoddto;
    const value = this.M.getRefPSDEMethodDTO;
    if (value == null) {
      return null;
    }
    this.refpsdemethoddto = this.getRefPSDataEntityMust().findPSDEMethodDTO(value);
    return this.refpsdemethoddto;
  }

  get refPSDEMethodDTO(): IPSDEMethodDTO | null {
    return this.getRefPSDEMethodDTO();
  }

  getRefPSDEMethodDTOMust(): IPSDEMethodDTO {
    const value = this.getRefPSDEMethodDTO();
    if (value == null) {
      throw new Error('未指定引用实体方法DTO对象');
    }
    return value;
  }

  protected refpsdataentity: IPSDataEntity | null = null;

  getRefPSDataEntity(): IPSDataEntity | null {
    if (this.refpsdataentity != null) return this.refpsdataentity;
    const value = this.M.getRefPSDataEntity;
    if (value == null) {
      return null;
    }
    this.refpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getRefPSDataEntity') as IPSDataEntity;
    return this.refpsdataentity;
  }

  get refPSDataEntity(): IPSDataEntity | null {
    return this.getRefPSDataEntity();
  }

  getRefPSDataEntityMust(): IPSDataEntity {
    const value = this.getRefPSDataEntity();
    if (value == null) {
      throw new Error('未指定引用实体对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSLinkDEMethodDTOImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.service.IPSLinkDEMethodDTO') return true;
    return super.instanceof(cls);
  }
}
